// Copyright (c) 2002 HTHK

package tss.restrict;

import com.ffpc.sql.*;

import tss.restrict.RestrictBean;

public class Restrict
   extends DataObject
   implements RestrictBean
{
   private String before_quantity = null;
   private String after_quantity = null;
   private String unit = null;
   private Column ColBeforeQuantity = null;
   private Column ColAfterQuantity = null;
   private Column ColUnit = null;
   /**
    * Constructor
    */
   public Restrict()
   {
       ColBeforeQuantity = new Column(0,"before_quantity",Column.Types.integer,null,4,false);
       ColAfterQuantity = new Column(1,"after_quantity",Column.Types.integer,null,4,false);
       ColUnit = new Column(2,"unit",Column.Types.string,null,1,false);
   }

   // functions belongs to RestrictBean interface

   @Override
public void setBefore_quantity(String before_quantity)
   {       this.before_quantity = this.setAttribute(ColBeforeQuantity,before_quantity);
   }

   @Override
public String getBefore_quantity()
   {       return this.before_quantity==null?"":this.before_quantity;
   }

   @Override
public void setAfter_quantity(String after_quantity)
   {       this.after_quantity = this.setAttribute(ColAfterQuantity,after_quantity);
   }

   @Override
public String getAfter_quantity()
   {       return this.after_quantity==null?"":this.after_quantity;
   }

   @Override
public void setUnit(String unit)
   {       this.unit = this.setAttribute(ColUnit,unit);
   }                                            

   @Override
public String getUnit()
   {       return this.unit==null?"":this.unit;
   }

   // belongs to row interface

   @Override
public Column[] createColumns()
   {
       Column[] cols = new Column[3];
       cols[0] = ColBeforeQuantity.clone(null);
       cols[1] = ColAfterQuantity.clone(null);
       cols[2] = ColUnit.clone(null);
       return cols;
   }

   // super's abstract methods

   @Override
public String getTableName()
   {
       return "tss.tss_c_restrict";
   }

   @Override
protected String[] getKeyColumnNames()
   {
       String[] list = {
                         "unit"
                       };
       return list;
   }

   @Override
protected String[] getUpdatableColumnNames()
   {
       String[] list = {
                         "before_quantity"
                         ,"after_quantity"
                       };
       return list;
   }

   @Override
protected void retrieveColumnValues()
   {
       this.before_quantity = this.retrieveColumnValue("before_quantity");
       this.after_quantity = this.retrieveColumnValue("after_quantity");
       this.unit = this.retrieveColumnValue("unit");
   }
}

